package org.feng.utils;


import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author by feng
 * @des redisHash
 * @date 2021/4/27 14:03
 */
public class ColumnFormat {

    private final static Pattern humpPattern = Pattern.compile("[A-Z]");

    public static String humpToLine2(String str) {
        Matcher matcher = humpPattern.matcher(str);
        StringBuffer sb = new StringBuffer();
        while (matcher.find()) {
            matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
        }
        matcher.appendTail(sb);
        return sb.toString();
    }

}
